#define _CRT_SECURE_NO_WARNINGS 1
#include <vector>
#include <algorithm>
using namespace std;
class Solution {
public:
    int minNumberDisappeared(vector<int>& nums)
    {
        // for(auto a:nums) cerr<<a<<' ';
        // cerr<<endl;
        int n = nums.size();
        for (int i = 0;i < n;++i)
        {
            if (nums[i] <= 0)  nums[i] = n + 1;
        }
        for (int i = 0;i < n;++i)
        {
            if (abs(nums[i]) <= n)
            {
                nums[abs(nums[i]) - 1] = -1 * nums[abs(nums[i]) - 1];
            }
        }
        for (int i = 0;i < n;++i)
        {
            //cout<<nums[i]<<endl;
            if (nums[i] > 0) return i + 1;
        }
        return n + 1;
    }
};